/*
* Copyright (C) Microsoft. All rights reserved.  
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not 
* use this file except in compliance with the License.  You may obtain a copy 
* of the License at http://www.apache.org/licenses/LICENSE-2.0  
* 
* THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 
* WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
* MERCHANTABLITY OR NON-INFRINGEMENT. 
*
* See the Apache License, Version 2.0 for specific language governing 
* permissions and limitations under the License.
*
*/
#pragma once

#include <baja/common.hpp>

namespace baja { namespace math {

namespace c
{
    const float32 pi = 3.14159265f;
    const float32 floatEpsilon = 0.000025f;
    const float32 onOrAboveEpsilon = 0.01f;
};

BAJA_INLINE float32 degToRad(const float32 degrees)
{ 
    return degrees * c::pi / 180.0f; 
}

BAJA_INLINE float32 radToDeg(const float32 radians)
{ 
    return radians * 180.0f / c::pi; 
}

BAJA_INLINE float32 logbasef(const float32 a, const float32 base)
{
   return logf(a) / logf(base);
}

// 2d
struct point2d;
struct vector2d;
struct rectangle;

// 3d
struct point3d;
struct vector3d;
struct line3d;
struct plane3d;

// 4d
struct point4d;
struct quaternion;

// matrices
struct matrix33;
struct matrix44;

bool
isOBBIntersectingLineSegment(
    const point3d& boxCenter,
    const vector3d& boxExtents0,
    const vector3d& boxExtents1,
    const vector3d& boxExtents2,
    const line3d& lineSegment
    );

bool 
isOBBIntersectingTriangle(
    const point3d& boxCenter,
    const vector3d& boxExtents0,
    const vector3d& boxExtents1,
    const vector3d& boxExtents2,
    const point3d& triPoint0,
    const point3d& triPoint1,
    const point3d& triPoint2
    );

void
linearCombine(
    const vector3d& v0, 
    float32 scale0, 
    const vector3d& v1, 
    float32 scale1, 
    vector3d* outResult
    );

}} // namespace baja.math